﻿<UserControl
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:AppCommerciaux.Views" x:Class="AppCommerciaux.Views.CommandeView" 
      mc:Ignorable="d"
      d:DesignHeight="545" d:DesignWidth="1010">

    <Grid HorizontalAlignment="Left" Background="AliceBlue" Height="545" Width="1010">
        <Grid.Resources>
            <!--DataTemplate for Published Date column defined in Grid.Resources.  PublishDate is a property on the ItemsSource of type DateTime -->
            <DataTemplate x:Key="textTemplate" >
                <!--<StackPanel Width="20" Height="30">
                    <Border Background="LightBlue" BorderBrush="Black" BorderThickness="1">
                        <TextBlock Text="{Binding Detail}" FontSize="8" HorizontalAlignment="Center" />
                    </Border>
                </StackPanel>-->

                <StackPanel>
                    <TextBlock Text="{Binding Detail}"/>
                </StackPanel>

            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="300" />
            <RowDefinition Height="50" />
            <RowDefinition Height="60" />
            <RowDefinition Height="60" />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition Width="300"/>
            <ColumnDefinition Width="300"/>
            <ColumnDefinition Width="300"/>
        </Grid.ColumnDefinitions>
        <TextBlock
			Text="{Binding Titre}"
            Grid.ColumnSpan="2"/>
        <DataGrid x:Name="dataGridCommande"
                  IsReadOnly="True"
                  SelectionMode="Single"
			Grid.Row="1"
			Grid.ColumnSpan="4"
			ItemsSource="{Binding ListCommande,
            Mode=TwoWay,
            UpdateSourceTrigger=PropertyChanged}"
			SelectedItem="{Binding SelectedCommande}" Margin="52,0,166,0" Grid.RowSpan="2"/>

        <!--Mode=TwoWay,
            UpdateSourceTrigger=PropertyChanged-->

        <Button x:Name="buttonPDF" Content="Générer PDF" HorizontalAlignment="Left" Margin="152,40,0,0" Grid.Row="3" VerticalAlignment="Top" Width="75" Click="Button_Click_PDF" Grid.ColumnSpan="2"/>
        <Button Content="Ajouter" Grid.Column="1" HorizontalAlignment="Left" Margin="156,35,0,0" Grid.Row="3" VerticalAlignment="Top" Width="120" Height="23" IsEnabled="{Binding EnableButtonAjouter}"  Command="{Binding BoutonAjouterCommande}"/>
        <Button Content="Modifier" Grid.Column="2" HorizontalAlignment="Left" Height="23" Margin="0,35,0,0" Grid.Row="3" VerticalAlignment="Top" Width="120" IsEnabled="{Binding EnableButtonModifier}" Command="{Binding BoutonModifierCommande}"/>
        <Button Content="{Binding LabelboutonSupprimer}" Grid.Column="2" Grid.ColumnSpan="4" HorizontalAlignment="Left" Height="23" Margin="148,35,-22,0" Grid.Row="3" VerticalAlignment="Top" Width="175" IsEnabled="{Binding EnableButtonSupprimer}" Command="{Binding BoutonSupprimerCommande}"/>

    </Grid>
</UserControl>
